const express = require('express');
const router = express.Router();
const { auth } = require('../middlewares/auth');
const aiController = require('../controllers/aiController');

// @route   POST /api/ai/chat
// @desc    发送消息到AI并获取回复
// @access  Private
router.post('/chat', auth, aiController.sendMessage);

// @route   GET /api/ai/conversations
// @desc    获取用户的所有对话
// @access  Private
router.get('/conversations', auth, aiController.getUserConversations);

// @route   GET /api/ai/conversations/:id
// @desc    获取特定对话的所有消息
// @access  Private
router.get('/conversations/:id', auth, aiController.getConversationMessages);

// @route   DELETE /api/ai/conversations/:id
// @desc    删除对话
// @access  Private
router.delete('/conversations/:id', auth, aiController.deleteConversation);

// @route   PUT /api/ai/conversations/:id
// @desc    更新对话标题
// @access  Private
router.put('/conversations/:id', auth, aiController.updateConversationTitle);

module.exports = router; 